<?php
/**
 * Enter description here ...
 * @author Micou13630
 */
class RelativeDateItem extends CanvasItem implements IRenderable {
	
	protected $baseDate;
	protected $centuryTreshold;
	
	protected $daysAgoTitle = "Il y a N jours";
	protected $daysFromNowTitle = "Dans N jours";
	protected $hoursAgoTitle;
	protected $hoursFromNowTitle;
	protected $millisecondsAgoTitle;
	protected $millisecondsFromNowTitle;
	protected $minutesAgoTitle;
	protected $minutesFromNowTitle;
	protected $monthsAgoTitle;
	protected $monthsFromNowTitle;
	protected $secondsAgoTitle;
	protected $secondsFromNowTitle;
	protected $weeksAgoTitle;
	protected $weeksFromNowTitle;
	protected $yearsAgoTitle;
	protected $yearsFromNowTitle;
	
	protected $todayTitle;
	
	protected $presetOptions;
	protected $timeUnitOptions;
	
	protected $pickerIconPrompt;
	protected $useSharedPicker;
	
	protected $defaultQuantity;
	protected $defaultValue;
	
	protected $displayFormat;
	protected $inputFormat;
	
	protected $startDate;
	protected $endDate;
	
	protected $showCalculatedDateField;
	protected $showChooserIcon;
	
	/**
	 * Constructeur
	 * @param unknown_type $name
	 */
	public function RelativeDateItem($name) {
		parent::CanvasItem($name, Constant::EDITOR_TYPE_RELATIVEDATE);
		$this->presetOptions = new RelativeDateOptionsPreset();
	}
	
	/**
	 * Implementation de object
	 * @see IRenderable::object()
	 */
	public function object() {
		return get_class($this);
	}

	/**
	 * Implementation de properties
	 * @see IRenderable::properties()
	 */
	public function properties() {
		return parent::getProp($this);
	}
	
	/**
	 * Implementation de scLog
	 * @see IRenderable::scLog()
	 */
	public function scLog() {
		ScCollectionLog::getInstance()->addSc(new ScLog($this->object(), get_object_vars($this)));
	}

	/**
	 * Implementation de render
	 * @see IScreen::render()
	 */
	public function render() {
		$this->scLog();
		return "{".$this->properties()."}";
	}
}

/**
 * Enter description here ...
 * @author Micou13630
 *
 */
class RelativeDateOptionsPreset extends ExpressionType {
	public function RelativeDateOptionsPreset() {
		$str = '{"$today":"Aujourd\'hui","$yesterday":"Hier","$tomorrow":"Demain","-1w":"Il y a 1 semaine","+1w":"Dans 1 semaine"}';
		parent::ExpressionType($str);
	}
}
?>
